<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>web安全 | 学习笔记</title><meta name="author" content="lzoxun"><meta name="copyright" content="lzoxun"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="漏洞排名 session、cookie 和 XSS跨站脚本攻击 HTTP 请求式应答 (有请求才有返回) 灵活可扩展 (可传输各种类型数据,请求头 响应头可自定义，只要相互认识) 可靠传输 无状态 弊端  发送请求服务器默认是不知道谁在访问的 每次访问都是独立的，无法保持会话   解决方案cookie  http扩展功能 Set-Cookie:第一次访问服务器主动响应给客户端，种cookie Co">
<meta property="og:type" content="article">
<meta property="og:title" content="web安全">
<meta property="og:url" content="http://example.com/2023/07/22/web/JavaScript/%E5%9E%83%E5%9C%BE%E6%A1%B6/web-safety/index.html">
<meta property="og:site_name" content="学习笔记">
<meta property="og:description" content="漏洞排名 session、cookie 和 XSS跨站脚本攻击 HTTP 请求式应答 (有请求才有返回) 灵活可扩展 (可传输各种类型数据,请求头 响应头可自定义，只要相互认识) 可靠传输 无状态 弊端  发送请求服务器默认是不知道谁在访问的 每次访问都是独立的，无法保持会话   解决方案cookie  http扩展功能 Set-Cookie:第一次访问服务器主动响应给客户端，种cookie Co">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png">
<meta property="article:published_time" content="2023-07-22T07:14:09.692Z">
<meta property="article:modified_time" content="2023-07-22T07:14:09.692Z">
<meta property="article:author" content="lzoxun">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/2023/07/22/web/JavaScript/%E5%9E%83%E5%9C%BE%E6%A1%B6/web-safety/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":true,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'web安全',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-07-22 15:14:09'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>(()=>{
  const $loadingBox = document.getElementById('loading-box')
  const $body = document.body
  const preloader = {
    endLoading: () => {
      $body.style.overflow = ''
      $loadingBox.classList.add('loaded')
    },
    initLoading: () => {
      $body.style.overflow = 'hidden'
      $loadingBox.classList.remove('loaded')
    }
  }

  preloader.initLoading()
  window.addEventListener('load',() => { preloader.endLoading() })

  if (false) {
    document.addEventListener('pjax:send', () => { preloader.initLoading() })
    document.addEventListener('pjax:complete', () => { preloader.endLoading() })
  }
})()</script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">108</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog-info"><a href="/" title="学习笔记"><span class="site-name">学习笔记</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">web安全</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-07-22T07:14:09.692Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-07-22T07:14:09.692Z" title="更新于 2023-07-22 15:14:09">2023-07-22</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="web安全"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p><a target="_blank" rel="noopener" href="https://owasp.org/www-project-top-ten/">漏洞排名</a></p>
<h3 id="session、cookie-和-XSS跨站脚本攻击"><a href="#session、cookie-和-XSS跨站脚本攻击" class="headerlink" title="session、cookie 和 XSS跨站脚本攻击"></a>session、cookie 和 XSS跨站脚本攻击</h3><ul>
<li>HTTP<ul>
<li><code>请求式应答</code> (有请求才有返回)</li>
<li><code>灵活可扩展</code> (可传输各种类型数据,请求头 响应头可自定义，只要相互认识)</li>
<li><code>可靠传输</code></li>
<li><code>无状态</code><ul>
<li><p>弊端</p>
<ul>
<li>发送请求服务器默认是不知道谁在访问的</li>
<li>每次访问都是独立的，无法保持会话</li>
</ul>
</li>
<li><p>解决方案<code>cookie</code></p>
<ul>
<li>http扩展功能</li>
<li>Set-Cookie:<code>第一次访问</code>服务器<code>主动响应</code>给客户端，<code>种cookie</code></li>
<li>Cookie:之后请求，客户端<code>自动携带Cookie</code>去访问服务</li>
<li>方式:访问域名 -&gt; 携带cookie到客户端 -&gt; 客户端存储cookie -&gt; 在访问时通过请求头携带到服务器 <ul>
<li>再次访问服务器就知道谁在访问自己了</li>
</ul>
</li>
<li>格式:<ul>
<li>键值对(必须)</li>
<li><code>expires</code>:设置过期时间</li>
<li><code>max-age</code>:多久过期(秒，优先级高于expires)</li>
<li><code>domain</code>:对哪个域名生效</li>
<li><code>path</code>:匹配的路径(如果是<code>path=/</code>代表域名所有子域名及下所有路径都能使用)</li>
<li><code>secure</code>: 是否只允许HTTPS,才发送Cookie到服务器</li>
<li><code>httponly</code>:不允许通过<code>document.cookie</code>去修改此cookie</li>
</ul>
</li>
<li>保存位置:<ul>
<li><code>没有设置</code>过期时间则<code>保存在内存</code>，浏览器<code>关闭即失效</code></li>
<li><code>设置expires</code>就是持久的，保存在磁盘，<code>各个浏览器</code>保存的<code>位置</code>和<code>方式</code>都不一样</li>
</ul>
</li>
<li>特点:<ul>
<li><code>明文</code></li>
<li><code>用户可修改</code></li>
<li><code>大小受限</code></li>
<li><code>臃肿</code>:每次请求头都要携带，所有需要的cookie</li>
</ul>
</li>
<li>作用 <ul>
<li>记录登录状态，打开网址，发现cookie存在表示已登入</li>
<li>跟踪用户行为</li>
</ul>
</li>
</ul>
</li>
<li><p>session</p>
<ul>
<li>session信息是保存在服务端的，每次还是要<code>通过cookie</code>携带<code>sessionId</code>的</li>
<li>工作流程<ul>
<li>进入页面判断是否能达到用户信息</li>
<li>不能进入登录窗口</li>
<li>登录成功 session保存用户信息</li>
<li>后端只有判断是否能拿到用户信息，可以显示内容，否则显示登录窗口</li>
<li>退出清除session，否则一直是登录状态</li>
</ul>
</li>
<li><code>sessionId</code>还是通过cookie与客户端交流的</li>
<li>问题<ul>
<li>别人找到你某个网站的sessionId，没退出的，复制到自己的浏览器上，因为服务点保存了你的状态，那么理论上就能直接登录你的账户了</li>
</ul>
</li>
</ul>
</li>
<li><p>远程操作cookie</p>
<ul>
<li>操作<ul>
<li>获取 document.cookie</li>
<li>修改 document.cookie&#x3D;”name&#x3D;xxx”</li>
</ul>
</li>
<li>攻击方式<ul>
<li>XSS:Cross Site Script<ul>
<li>利用web漏洞插入恶意代码，用户访问的时候，执行代码，获取用户身份从而达到攻击的目的</li>
<li>获取哪个网站的信息就要将脚本注入到哪个网站</li>
<li>漏洞<ul>
<li>页面直接将query拿来直接执行</li>
<li>页面直接将input的值拿来执行</li>
</ul>
</li>
<li>反射形XSS<ul>
<li>一次性的，用户操作一次攻击一次那种，如果点击query传入的链接</li>
<li>需要诱导用户去操作<br>  <img src= "" data-lazy-src="/../../../../static/img/XSS1.png" alt="反射型XSS"></li>
</ul>
</li>
<li>存储型XSS<ul>
<li>通过<code>评论、留言、注册恶意用户名</code>等方式将<code>恶意代码</code>提交到你的数据库，别人访问恶意用户或恶意用户的消息，就从数据库查出来恶意代码，就自动执行恶意代码</li>
<li>恶意代码可以是自动访问，第三方js,或恶意链接,直接拿到你在这个网站的信息<br>  <img src= "" data-lazy-src="/../../../../static/img/XSS2.png" alt="存储型XSS"></li>
</ul>
</li>
<li>作用<ul>
<li>冒充身份</li>
<li>刷点击</li>
<li>弹广告</li>
<li>传播蠕虫病毒(通过访问发送，一传十。。。)</li>
</ul>
</li>
<li>防止<ul>
<li>输入<ul>
<li>识别恶意脚本，定义恶意脚本格式</li>
<li>脚本格式扩展变形 如:<code>&lt;scri&lt;script&gt;pt&gt;</code> </li>
<li>通过正则找出来后干掉或静止此用户操作</li>
</ul>
</li>
<li>输出<ul>
<li>将一些特殊符号如<code>&lt;&gt;&quot;&#39;%</code>等符号进行转义</li>
</ul>
</li>
<li>个人的处理不全,用插件WAF来安全防护服务器<ul>
<li>第三方规则引擎，waf规则仓<ul>
<li>硬件、云产品、开源库如:Apath 的 mod_security，modsecurity.cn</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="CSRF-跨站请求伪造"><a href="#CSRF-跨站请求伪造" class="headerlink" title="CSRF 跨站请求伪造"></a>CSRF 跨站请求伪造</h3><ul>
<li>流程<ul>
<li>打开<code>登录</code>重要的网站,或者某个重要网站的cookie还在本地</li>
<li>本地储存重要网站的信息</li>
<li><code>访问乱七八糟</code>的网站 -&gt; 返回<code>包含恶意请求</code>的页面如<code>&lt;img width=0 height=0 src=&quot;调用重要网站的某个接口&quot; /&gt;</code></li>
<li>如果<code>调用的重要网站地址</code>正好是你<code>刚刚登入的</code>，就调用成功了<br>  <img src= "" data-lazy-src="/../../../../static/img/CSRF.png" alt="CSRF"></li>
</ul>
</li>
<li>恶意请求方式<ul>
<li>加载图片请求、点击a链接请求，隐藏的可自动提交的表达—后面js自动提交表单</li>
</ul>
</li>
<li>预防<ul>
<li>如何确定一个接口地址是否拥有CSRF漏洞?<ul>
<li>我自己没有输入账号密码，没有产生我的cookie，发起对一个接口的请求，只要正常响应了，那么这个接口是存在CSRF漏洞的</li>
<li>需要登录的接口，公开的一些接口就没有意义了</li>
</ul>
</li>
<li>具体操作<ul>
<li>判断来源<ul>
<li>请求头的 referer 表示用户从哪个页面来访问的</li>
<li>后端通过判断 referer 来防止CSRF，但是可以伪造，并不可信</li>
</ul>
</li>
<li>加密<ul>
<li>客户端对cookie进行加密，发送到服务端，服务端以同样方式进行加密，与客户端的进行对比</li>
<li>因为CSRF拿不到cookie明文，所以这是可以防止的，如果用XSS偷到cookie，那么这也不安全</li>
</ul>
</li>
<li>token</li>
<li>验证码、支付输入密码、选择出所以自行车、将图片选择正等操作，时重要接口变成交互性的二次验证</li>
</ul>
</li>
<li>第三方工具发现漏洞<ul>
<li>Blot, blot.py -u url,测试这个接口是否存在CSRF漏洞</li>
<li>T-Sec 漏洞扫描收费服务</li>
</ul>
</li>
</ul>
</li>
<li>与XSS的差别<ul>
<li>利用你保存的cookie，拿不到对方的cookie</li>
<li>需要自己准备第三方网站，或将代码通过XSS方式注入到其他网站让你点，不要直接把代码注入到要攻击的网站</li>
</ul>
</li>
</ul>
<h3 id="sql注入、弱密码"><a href="#sql注入、弱密码" class="headerlink" title="sql注入、弱密码"></a>sql注入、弱密码</h3><p><a target="_blank" rel="noopener" href="https://www.coolshell.cn/">https://www.coolshell.cn/</a></p>
<h3 id="referer-与-Referrer-Policy-详解"><a href="#referer-与-Referrer-Policy-详解" class="headerlink" title="referer 与  Referrer Policy 详解"></a>referer 与  Referrer Policy 详解</h3><blockquote>
<p>请求的报头中，会包含一个 Referrer，用以指定该请求是<code>从哪个页面跳转</code>来的，常被用于<code>分析用户来源</code>等信息。但是也有成为用户的一个不安全因素，比如有些网站直接将 <code>sessionid</code> 或是 <code>token</code> 放在地址栏里传递的，会原样不动地当作 Referrer 报头的内容传递给第三方网站。</p>
</blockquote>
<blockquote>
<p>所以就有了 <code>Referrer Policy</code>，用于<code>过滤 Referrer</code> 报头内容</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">enum ReferrerPolicy &#123;</span><br><span class="line">  &quot;&quot;,</span><br><span class="line">  &quot;no-referrer&quot;,</span><br><span class="line">  &quot;no-referrer-when-downgrade&quot;,</span><br><span class="line">  &quot;same-origin&quot;,</span><br><span class="line">  &quot;origin&quot;,</span><br><span class="line">  &quot;strict-origin&quot;,</span><br><span class="line">  &quot;origin-when-cross-origin&quot;,</span><br><span class="line">  &quot;strict-origin-when-cross-origin&quot;,</span><br><span class="line">  &quot;unsafe-url&quot;</span><br><span class="line">&#125;;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">很多种过滤类型</span></span><br></pre></td></tr></table></figure>
<h3 id="文件上传漏洞"><a href="#文件上传漏洞" class="headerlink" title="文件上传漏洞"></a>文件上传漏洞</h3><ul>
<li>原理<ul>
<li>上传一个可以执行的脚本文件如php，里面有类似eval的语句将某些代码包裹,从而获得了可执行服务端命令的能力</li>
<li>当通过路径访问自己上传的文件时，eval就好解析出里面的代码</li>
</ul>
</li>
<li>如何绕过？</li>
<li>安全人员如何避免？<ul>
<li>静止指定类型文件上传，必要的化可以传压缩包</li>
<li>文件路径不要被用户获取</li>
<li>限制上传的文件的权限</li>
</ul>
</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://example.com">lzoxun</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2023/07/22/web/JavaScript/%E5%9E%83%E5%9C%BE%E6%A1%B6/web-safety/">http://example.com/2023/07/22/web/JavaScript/%E5%9E%83%E5%9C%BE%E6%A1%B6/web-safety/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">学习笔记</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/07/22/web/JavaScript/%E5%9E%83%E5%9C%BE%E6%A1%B6/web-library-mockjs/" title="Mockjs"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Mockjs</div></div></a></div><div class="next-post pull-right"><a href="/2023/07/22/web/JavaScript/%E5%9E%83%E5%9C%BE%E6%A1%B6/h5-model-webRTC/" title="webRTC 直播功能"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">webRTC 直播功能</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">lzoxun</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">108</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/liaozhongxun"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/liaozhongxun" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:869664233@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">这是我的文档</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#session%E3%80%81cookie-%E5%92%8C-XSS%E8%B7%A8%E7%AB%99%E8%84%9A%E6%9C%AC%E6%94%BB%E5%87%BB"><span class="toc-number">1.</span> <span class="toc-text">session、cookie 和 XSS跨站脚本攻击</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#CSRF-%E8%B7%A8%E7%AB%99%E8%AF%B7%E6%B1%82%E4%BC%AA%E9%80%A0"><span class="toc-number">2.</span> <span class="toc-text">CSRF 跨站请求伪造</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#sql%E6%B3%A8%E5%85%A5%E3%80%81%E5%BC%B1%E5%AF%86%E7%A0%81"><span class="toc-number">3.</span> <span class="toc-text">sql注入、弱密码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#referer-%E4%B8%8E-Referrer-Policy-%E8%AF%A6%E8%A7%A3"><span class="toc-number">4.</span> <span class="toc-text">referer 与  Referrer Policy 详解</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E6%BC%8F%E6%B4%9E"><span class="toc-number">5.</span> <span class="toc-text">文件上传漏洞</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-11/" title="win 11 set">win 11 set</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-gitbash/" title="git bash">git bash</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-wsl/" title="wsl">wsl</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-main/" title="window">window</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/web/%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98/" title="兼容问题">兼容问题</a><time datetime="2023-07-22T07:14:09.699Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By lzoxun</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><div class="js-pjax"></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/haruto.model.json"},"display":{"position":"right","width":100,"height":200,"right":300},"mobile":{"show":true}});</script></body></html>